package com.cskaoyan.controller.wx;

import com.cskaoyan.bean.common.BaseRespVo;
import com.cskaoyan.bean.vo.WxCatelogIndexVo;
import com.cskaoyan.service.WxCatelogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author gatsby
 * @since 2022/10/14 19:24
 */
@RestController
@RequestMapping("wx/catalog")
public class WxCategoryController {

    @Autowired
    WxCatelogService wxCatelogService;

    /**
     * 显示全部分类的业务逻辑
     *
     * @return com.cskaoyan.bean.common.BaseRespVo
     * @author gatsby
     * @since 2022/10/14 18:57
     */
    @GetMapping("index")
    public BaseRespVo index() {
        WxCatelogIndexVo wxCatalogIndexVo = wxCatelogService.queryAllCatelog();
        return BaseRespVo.ok(wxCatalogIndexVo, "成功");
    }

    @GetMapping("current")
    public BaseRespVo current(Integer id){
        WxCatelogIndexVo wxCatalogIndexVo=wxCatelogService.queryCurrentCategory(id);
        return BaseRespVo.ok(wxCatalogIndexVo,"成功");
    }
}
